Crate usb_gadget

source ·
Expand description

This library allows implementation of USB peripherals, so called USB gadgets, on Linux devices that have a USB device controller (UDC). Both, pre-defined USB functions and fully custom implementations of the USB interface are supported.

§Requirements

A USB device controller (UDC) supported by Linux is required.

The Linux kernel configuration options CONFIG_USB_GADGET and CONFIG_USB_CONFIGFS need to be enabled.

root permissions are required to configure USB gadgets and the configfs filesystem needs to be mounted.

§Usage

Start defining an USB gadget by calling Gadget::new. When the gadget is fully specified, call Gadget::bind to register it with a USB device controller (UDC).

Modules§

Structs§

  • USB gadget or interface class.
  • USB gadget configuration.
  • USB gadget definition.
  • USB gadget id.
  • USB gadget operating system descriptor.
  • USB gadget registered with the system.
  • USB gadget description strings.
  • USB device controller (UDC).
  • USB gadget WebUSB descriptor.

Enums§

Functions§

  • The default USB device controller (UDC) in the system by alphabetical sorting.
  • Get all USB gadgets registered on the system.
  • Remove all USB gadgets defined on the system.
  • Gets the available USB device controllers (UDCs) in the system.
  • Unbind all USB gadgets defined on the system.